﻿using System;
using System.Collections.Generic;
using YaAppoint.Appointments.Pools;

namespace YaAppoint.Appointments.HisAppoint
{
    [Serializable]
    public class Interval
    {
        public Guid Id { get; set; }

        // 开始时间
        public DateTime StartTime { get; set; }

        // 结束时间
        public DateTime EndTime { get; set; }
       
        // 号段日期
        public DateTime Date { get; set; }

        // 所含号池
        public List<PoolDto> Pools { get; set; }

        // 推荐ID
        public Guid SuggestionId { get; set; }

        public string Title 
        {
            get
            {
                return $" {StartTime.ToString("hh:mm")}-{EndTime.ToString("hh:mm")}";
            }
        }

        // 显示名
        public string DisplayName 
        {
            get
            {
                return $"{Date.ToString("MM月dd日")}     {StartTime.ToString("tt hh:mm")}-{EndTime.ToString("hh:mm")}";
            }
        }

        public int MaxCount { get; set; } = 0;

        public int CurrentCount { get; set; } = 0;

        /// <summary>
        /// 上午还是下午
        /// </summary>
        public int PeriodOfDay 
        {
            get
            {
                if (StartTime < StartTime.Date.AddHours(12))
                {
                    return 0;
                }
                else
                {
                    return 1;
                }
            }
        }
    }
}
